using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;
using System.ComponentModel;

namespace QiHe.ReliableData
{
    public class EnumType
    {
        private string name;

        [XmlAttribute]
        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        private bool isFlags;

        [XmlAttribute]
        public bool IsFlags
        {
            get { return isFlags; }
            set { isFlags = value; }
        }

        private List<EnumValue> values = new List<EnumValue>();

        [Browsable(false)]
        [XmlElement("EnumValue")]
        public List<EnumValue> Values
        {
            get { return values; }
            set { values = value; }
        }

        public EnumType() { }

        public EnumType(string name)
        {
            Name = name;
        }

        public override string ToString()
        {
            return Name;
        }
    }

    public class EnumValue
    {
        //public string Name;
        //public int Value;
        //public string Description;

        private string name;

        [Category("Literal")]
        public string Name
        {
            get
            {
                return name;
            }
            set
            {
                if (name != value)
                {
                    name = value;
                }
            }
        }

        private int intvalue;

        [Category("Literal")]
        public int Value
        {
            get
            {
                return intvalue;
            }
            set
            {
                if (value != intvalue)
                {
                    intvalue = value;
                }
            }
        }

        private string description;

        public string Description
        {
            get
            {
                return description;
            }
            set
            {
                if (description != value)
                {
                    description = value;
                }
            }
        }

    }
}
